<%@ page import="com.tlb.ejb.*,com.tlb.dto.*,com.tlb.web.*,java.util.*" %>
<%

Poster p = new AuthManager(request, response).softAuthenticatePoster();
if (p == null) {
    request.getRequestDispatcher("/login.jsp?action=new").forward(request, response);
    return;
}

%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
    <head>
        <title>Big<%=Util.getUtil().getBoard(request) == Util.BCB ? "College" : "Law"%>Board.com</title>
        <link rel="stylesheet" type="text/css" href="ext/tlbStyle.css" />
        <link rel="shortcut icon" href="ext/c_sailboat.gif">
        <script type="text/javascript" src="ext/tlbMenu.js" />
        <script type="text/javascript">
            window.onload = initLeftMenu;
            
            
            
        </script>
        
        
        <script>
            function checkForm() {
                var form = document.forms.ntForm;
                
                if(form.title.value.length < 1 || form.title.value.length > 63) {
                    document.getElementById("subError").innerHTML = "<font color=red>Title must be between 1 and 63 characters</font>";
                    return;
                } else {
                document.getElementById("subBtn").disabled=true;
                form.submit();
            }
        }
        </script>
        
    </head>
    
    <body onload="initLeftMenu()">
        <center>
            <div id="mainContainer">
                
                <table>
                    
                    <tr>
                        <td valign="top">
                            <%@ include file="header.jsp" %>
                            <br />
                            
                            <div id="contentContainer" style="background-color:#FFFFFF">
                                <h1>New Thread</h1>
                                <br />
                                
                                <form name=ntForm method="post" action="newThreadAction.jsp">
                                    <table>
                                        <tr>
                                            <td><b>Moniker</b></td>
                                            <td>
                                                <select name="monikerId">
                                                    <option default value="<%= p.getPrimaryMoniker().getMonikerId() %>"><%= p.getPrimaryMoniker().getName() %></option>
                                                    <%
            Set mons = p.getMonikers();
            mons.remove(p.getPrimaryMoniker());
            if (mons.size() > 0) {
                for (Iterator it = mons.iterator(); it.hasNext();) {
                    Moniker mon = (Moniker) it.next();
                    if (mon.getName().equals("Guest")) {
                        continue;
                    }
                                                    %><option value="<%= mon.getMonikerId() %>"><%= mon.getName() %></option>
                                                    <%
                }
            }
                                                    %>
                                                </select>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td><b>Thread Title</b></td>
                                            <td>
                                                <input name="title" size="50" maxlength="63">
                                                <b>NSFW?</b> <input type=checkbox name=nsfw value=true> 
                                            </td>
                                        </tr>
                                        <tr>
                                            <td valign="top"><b>First Post</b></td>
                                            <td><textarea name="cont" cols="47" rows="11"></textarea></td>
                                        </tr>
                                        <tr>
                                            <td><input id=subBtn type=button onclick="checkForm()" class=btn value=Post></td><td><span id=subError></span></td>
                                        </tr>
                                    </table>
                                </form>
                            </div>
                        </td>
                        <td valign=top>
                            
                            <%@ include file="menu.jsp" %>
                            
                        </td>
                    </tr>
                </table>
                
                
            </div>
            <!-- Start of StatCounter Code -->
            <script type="text/javascript">
                var sc_project=2753481; 
                var sc_invisible=0; 
                var sc_partition=27; 
                var sc_security="fadeb289"; 
            </script>
            <script type="text/javascript" src="http://www.statcounter.com/counter/counter_xhtml.js"></script><noscript><div class="statcounter"><a class="statcounter" href="http://www.statcounter.com/"><img class="statcounter" src="http://c28.statcounter.com/2753481/0/fadeb289/0/" alt="blog stats" /></a></div></noscript>
            <!-- End of StatCounter Code -->
        </center> 
    </body>
</html>